import sys
import time

try:
  from OpenGL.GLUT import *
  from OpenGL.GL import *
  from OpenGL.GLU import *
  from OpenGL.GLE import *
except:
  print 'ERROR: PyOpenGL no esta instalado correctamente.'
  sys.exit()


# dibujo el rombo rojo
def poli_recur():
        m=0.5
	n=0
	for i in range(40):
		poligono4(n) #llamo a la funcio poligono4
		n=n+1
	for i in range(40):
                poligono4(m)
                m=m+1



# Draw a square (quadrilateral) # en este for genero los 4 rectangulos de mi reloj en concreto los que corresponden a
# las 12,3,6 y 9.
def rectangulo():
        for i in range(4):
		glBegin(GL_QUADS)                   # Start drawing a 4 sided polygon
		glVertex3f(-4.0,80.5 , 0.0)          # Top Left ,vertice superior izquierdo
		glVertex3f(4.0, 80.5, 0.0)           # Top Right ,vertice superior derecho
		glVertex3f(4.0, 57.0, 0.0)          # Bottom Right ,vertice inferior derecho 
		glVertex3f(-4.0, 57.0, 0.0)         # Bottom Left  , vertice inferior izquierdo
		glEnd()                             # We are done with the polygon
		glRotate(90,0.0,0.0,1.0)            # roto 90 grados
		

	   


# Draw a square (quadrilateral) # en este for genero los 8 rectangulos de mi reloj en concreto los que corresponden a
# las 1,2,4,5,7,8,10,11.
def rectangulo2():
        for i in range(12):
		glBegin(GL_QUADS)                   # Start drawing a 4 sided polygon
		
		glVertex3f(-3.0,80.5 , 0.0)          # Top Left ,vertice superior izquierdo
		glVertex3f(3.0, 80.5, 0.0)           # Top Right ,vertice superior derecho
		glVertex3f(3.0, 57.0, 0.0)          # Bottom Right ,vertice inferior derecho 
		glVertex3f(-3.0, 57.0, 0.0)         # Bottom Left  , vertice inferior izquierdo
		glEnd()                             # We are done with the polygon
		glRotate(30,0.0,0.0,1.0)            # roto 30 grados



# Draw a square (quadrilateral) # en este for genero los  rectangulos de mi reloj en concreto los que corresponden a
# a los segundos.
def rectangulo3():
        for i in range(60):
		glBegin(GL_QUADS)                   # Start drawing a 4 sided polygon
		
		glVertex3f(-1.5,80.5 , 0.0)          # Top Left ,vertice superior izquierdo
		glVertex3f(1.5, 80.5, 0.0)           # Top Right ,vertice superior derecho
		glVertex3f(1.5, 70.0, 0.0)          # Bottom Right ,vertice inferior derecho 
		glVertex3f(-1.5, 70.0, 0.0)         # Bottom Left  , vertice inferior izquierdo
		glEnd()                             # We are done with the polygon
		glRotate(6,0.0,0.0,1.0)            # roto 6 grados



              

#dibujo la especie de triangulo a la izquierda abajo y arriba en el rombo
def poligono():
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,1.0)  # azul
	glVertex3f(0.0,0.0,0.1)
	glVertex3f(-30.0,75.0,0.1)
	glColor3f(1.0,1.0,0.0); # amarillo
	glVertex3f(-77.0,25.0,0.1)
	glColor3f(1.0,0.5,0.0); #naranja
	glVertex3f(-25.0,10.0,0.1)
	glVertex3f(-76.0,-30.0,0.1)
	glColor3f(1.0,0.0,0.0);	# Red
	glVertex3f(0.0,-79.0,0.1)
	glVertex3f(0.0,-60.0,0.1)
	glColor3f(0.0,1.0,0.0);	# Green
	glVertex3f(-15.0,-15.0,0.1)
	glEnd()
	
#dibujo la especie de triangulo a la derecha abajo del rombo
def poligono2():
	glBegin(GL_POLYGON)
	glVertex3f(0.0,0.0,0.0)
	glColor3f(0.0,0.0,1.0)  # azul
	glVertex3f(75.0,-2.0,0.0)
	glVertex3f(73.0,-5.0,0.0)
	glVertex3f(30.0,-10.0,0.0)
	glVertex3f(24.0,-72.0,0.0)
	glColor3f(1.0,1.0,0.0); # amarillo
	glVertex3f(55.0,-25.0,0.0)
	glVertex3f(14.0,-70.0,0.0)
	glColor3f(1.0,0.5,0.0); #naranja
	glVertex3f(7.0,-15.0,0.0)
	
	glEnd()


# dibujo el rombo rojo
def poligono4(x):

        x=x
        glBegin(GL_POLYGON)
	glColor3f(1.0,0.0,0.0);	
	glVertex3f(0.0,125.5,-x)
	glVertex3f(-103.5,0.0,-x)
	glVertex3f(0.0,-120.0,-x)
	glVertex3f(103.5,0.0,-x)
	glEnd()



#dibujo los numeros romanos
def numeros_romanos():
        #DOCE ROMANO
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(0.5,45.0,0.0)
	glVertex3f(2.5,45.0,0.0)
	glVertex3f(2.5,55.0,0.0)
	glVertex3f(0.5,55.0,0.0)
	glEnd()


	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(3.5,45.0,0.0)
	glVertex3f(6.0,45.0,0.0)
	glVertex3f(6.0,55.0,0.0)
	glVertex3f(3.5,55.0,0.0)
	glEnd()

	#HAGO LA X
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-0.5,45.0,0.0)
	glVertex3f(-0.5,48.0,0.0)
	glVertex3f(-5.5,55.0,0.0)
	glVertex3f(-5.5,52.0,0.0)
	glEnd()
	
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-5.5,45.0,0.0)
	glVertex3f(-0.5,52.0,0.0)
	glVertex3f(-0.5,55.0,0.0)
	glVertex3f(-5.5,48.0,0.0)
	glEnd()
	
	
        # UNO ROMANO
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(26.0,37.0,0.0)
	glVertex3f(28.0,37.0,0.0)
	glVertex3f(28.0,47.0,0.0)
	glVertex3f(26.0,47.0,0.0)
	glEnd()

        # DOS ROMANO
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); # NEGRO
	glVertex3f(42.0,19.0,0.0)
	glVertex3f(44.5,19.0,0.0)
	glVertex3f(44.5,29.0,0.0)
	glVertex3f(42.0,29.0,0.0)
	glEnd()
	
	glBegin(GL_POLYGON)
	glVertex3f(45.5,19.0,0.0)
	glVertex3f(47.5,19.0,0.0)
	glVertex3f(47.5,29.0,0.0)
	glVertex3f(45.5,29.0,0.0)
	glEnd()

        # TRES ROMANO
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(53.0,5.0,0.0)
	glVertex3f(53.0,-5.0,0.0)
	glVertex3f(55.0,-5.0,0.0)
	glVertex3f(55.0,5.0,0.0)
	glEnd()
	
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(50.0,5.0,0.0)
	glVertex3f(50.0,-5.0,0.0)
	glVertex3f(52.0,-5.0,0.0)
	glVertex3f(52.0,5.0,0.0)
	glEnd()
	
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(47.0,5.0,0.0)
	glVertex3f(47.0,-5.0,0.0)
	glVertex3f(49.0,-5.0,0.0)
	glVertex3f(49.0,5.0,0.0)
	glEnd()
	

        # CUATRO ROMANO
	
	#HAGO LA V ROMANA
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(43.0,-18.0,0.0)
	glVertex3f(40.0,-18.0,0.0)
	glVertex3f(45.0,-28.0,0.0)
	glVertex3f(45.0,-23.0,0.0)
	glEnd()
	
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(45.0,-23.0,0.0)
	glVertex3f(45.0,-28.0,0.0)
	glVertex3f(50.0,-18.0,0.0)
	glVertex3f(47.0,-18.0,0.0)
	glEnd()	

	#DIBUJO EL UNO
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(39.0,-18.0,0.0)
	glVertex3f(37.0,-18.0,0.0)
	glVertex3f(37.0,-28.0,0.0)
	glVertex3f(39.0,-28.0,0.0)
	glEnd()

        #CINCO ROMANO
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(26.0,-38.0,0.0)
	glVertex3f(23.0,-38.0,0.0)
	glVertex3f(28.0,-48.0,0.0)
	glVertex3f(28.0,-43.0,0.0)
	glEnd()


	
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(28.0,-43.0,0.0)
	glVertex3f(28.0,-48.0,0.0)
	glVertex3f(33.0,-38.0,0.0)
	glVertex3f(30.0,-38.0,0.0)
	glEnd()
	

        # SEIS ROMANO
	
	#hago la V
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-8.0,-45.0,0.0)
	glVertex3f(-3.0,-55.0,0.0)
	glVertex3f(-3.0,-50.0,0.0)
	glVertex3f(-5.0,-45.0,0.0)
	glEnd()
	
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-3.0,-55.0,0.0)
	glVertex3f(2.0,-45.0,0.0)
	glVertex3f(-1.0,-45.0,0.0)
	glVertex3f(-3.0,-50.0,0.0)
	glEnd()

	#hago un palote
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(3.0,-45.0,0.0)
	glVertex3f(3.0,-55.0,0.0)
	glVertex3f(5.0,-55.0,0.0)
	glVertex3f(5.0,-45.0,0.0)
	glEnd()
	
	
	
        # SIETE ROMANO

	#hago la v romana
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-37.0,-38.0,0.0)
	glVertex3f(-32.0,-48.0,0.0)
	glVertex3f(-32.0,-43.0,0.0)
	glVertex3f(-34.0,-38.0,0.0)
	glEnd()

	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-32.0,-43.0,0.0)
	glVertex3f(-32.0,-48.0,0.0)
	glVertex3f(-27.0,-38.0,0.0)
	glVertex3f(-30.0,-38.0,0.0)
	glEnd()
	
	#hago un palote
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-26.0,-38.0,0.0)
	glVertex3f(-26.0,-48.0,0.0)
	glVertex3f(-24.0,-48.0,0.0)
	glVertex3f(-24.0,-38.0,0.0)
	glEnd()
	
	#hago otro palote
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-23.0,-38.0,0.0)
	glVertex3f(-23.0,-48.0,0.0)
	glVertex3f(-21.0,-48.0,0.0)
	glVertex3f(-21.0,-38.0,0.0)
	glEnd()
	
	

        # OCHO ROMANO

	#hago la v romana
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-50.0,-18.0,0.0)
	glVertex3f(-45.0,-28.0,0.0)
	glVertex3f(-45.0,-23.0,0.0)
	glVertex3f(-47.0,-18.0,0.0)
	glEnd()

	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-45.0,-23.0,0.0)
	glVertex3f(-45.0,-28.0,0.0)
	glVertex3f(-40.0,-18.0,0.0)
	glVertex3f(-43.0,-18.0,0.0)
	glEnd()
	
	#hago un palote
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-39.0,-18.0,0.0)
	glVertex3f(-39.0,-28.0,0.0)
	glVertex3f(-37.0,-28.0,0.0)
	glVertex3f(-37.0,-18.0,0.0)
	glEnd()
	
	#hago otro palote
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-36.0,-18.0,0.0)
	glVertex3f(-36.0,-28.0,0.0)
	glVertex3f(-34.0,-28.0,0.0)
	glVertex3f(-34.0,-18.0,0.0)
	glEnd()
	
	
	#hago el ultimo palote
	glBegin(GL_POLYGON); #NEGRO
	glVertex3f(-33.0,-18.0,0.0)
	glVertex3f(-33.0,-28.0,0.0)
	glVertex3f(-31.0,-28.0,0.0)
	glVertex3f(-31.0,-18.0,0.0)
	glEnd()
	
        # NUEVE ROMANO
	
	#hago un palote
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-55.0,5.0,0.0)
	glVertex3f(-55.0,-5.0,0.0)
	glVertex3f(-53.0,-5.0,0.0)
	glVertex3f(-53.0,5.0,0.0)
	glEnd()

	#dibujo la X
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-52.0,5.0,0.0)
	glVertex3f(-52.0,2.0,0.0)
	glVertex3f(-47.0,-5.0,0.0)
	glVertex3f(-47.0,-2.0,0.0)
	glEnd()

	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-47.0,5.0,0.0)
	glVertex3f(-52.0,-2.0,0.0)
	glVertex3f(-52.0,-5.0,0.0)
	glVertex3f(-47.0,2.0,0.0)
	glEnd()



	
        # DIEZ ROMANO
	#dibujo la X
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-47.0,29.0,0.0)
	glVertex3f(-47.0,25.0,0.0)
	glVertex3f(-42.0,15.0,0.0)
	glVertex3f(-42.0,19.0,0.0)
	glEnd()

	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-47.0,19.0,0.0)
	glVertex3f(-47.0,15.0,0.0)
	glVertex3f(-42.0,25.0,0.0)
	glVertex3f(-42.0,29.0,0.0)
	glEnd()
		 
	
        # ONCE ROMANO
	#dibujo la X
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-28.0,47.0,0.0)
	glVertex3f(-28.0,43.0,0.0)
	glVertex3f(-23.0,33.0,0.0)
	glVertex3f(-23.0,37.0,0.0)
	glEnd()

	
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-28.0,33.0,0.0)
	glVertex3f(-23.0,43.0,0.0)
	glVertex3f(-23.0,47.0,0.0)
	glVertex3f(-28.0,37.0,0.0)
	glEnd()

	#dibujo un palote
	glBegin(GL_POLYGON)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glVertex3f(-22.0,47.0,0.0)
	glVertex3f(-22.0,34.0,0.0)
	glVertex3f(-20.0,34.0,0.0)
	glVertex3f(-20.0,47.0,0.0)
	glEnd()
	
	

	
#dibujo la manecilla de la hora
def hora():
	glBegin(GL_POLYGON)
	glColor3f(1.0,1.0,1.0); #blanco
	glVertex3f(0.0,0.0,-1.0) #1
	glVertex3f(-6.0,9.0,-1.0) #2
	glVertex3f(0.0,17.0,-1.0) #3
	glVertex3f(-6.0,24.0,-1.0) #4
	glVertex3f(-2.0,29.0,-1.0) #5
	glColor3f(0.0,0.0,0.0); #negro
	glVertex3f(0.0,46.0,-1.0) #6
	glVertex3f(2.0,29.0,-1.0) #7
	glVertex3f(6.0,24.0,-1.0) #8
	
	glVertex3f(0.0,17.0,-1.0) #9
	glVertex3f(6.0,9.0,-1.0) #10
	glVertex3f(0.0,0.0,-1.0) #11
	glEnd()


#dibujo el secundero
def segundero():
        glBegin(GL_POLYGON)
        glColor3f(0.0,0.0,0.0);  # azul
        glVertex3f(0.0,-20.0,-1.0)
        glVertex3f(-2.0,-10.0,-1.0)
        glVertex3f(-2.0,3.0,-1.0)
        glVertex3f(-4.0,25.0,-1.0)
        glVertex3f(0.0,80.0,-1.0)
        glColor3f(1.0,1.0,0.0); # amarillo
        glVertex3f(4.0,25.0,-1.0)
        glVertex3f(2.0,3.0,-1.0)
        glVertex3f(2.0,-10.0,-1.0)
        glEnd()




#dibujo la manecilla del minutero	
def minu():
       
	glBegin(GL_POLYGON)
	glColor3f(1.0,1.0,1.0); #blanco
	glVertex3f(0.0,0.0,-1.0) #1
	glVertex3f(-6.0,11.0,-1.0) #2
	glVertex3f(0.0,19.0,-1.0) #3
	glVertex3f(-6.0,26.0,-1.0) #4
	glVertex3f(-2.0,37.0,-1.0) #5
	glColor3f(0.0,0.0,0.0); #negro
	glVertex3f(0.0,62.0,-1.0) #6
	glVertex3f(2.0,37.0,-1.0) #7
	glVertex3f(6.0,26.0,-1.0) #8
	glVertex3f(0.0,19.0,-1.0) #9
	glVertex3f(6.0,11.0,-1.0) #10
	glVertex3f(0.0,0.0,-1.0) #11
	glEnd()


def minuchico():
        glBegin(GL_POLYGON)
	glColor3f(1.0,1.0,1.0); #blanco
	glVertex3f(0.0,0.0,-1.0) #1
	glVertex3f(-2.0,5.5,-1.0) #2
	glVertex3f(0.0,9.5,-1.0) #3
	glVertex3f(-2.0,13.0,-1.0) #4
	glVertex3f(-1.0,16.0,-1.0) #5
	glColor3f(0.0,0.0,0.0); #negro
	glVertex3f(0.0,22.0,-1.0) #6
	glVertex3f(1.0,16.0,-1.0) #7
	glVertex3f(3.0,13.0,-1.0) #8
	
	glVertex3f(0.0,9.5,-1.0) #9
	glVertex3f(3.0,5.5,-1.0) #10
	glVertex3f(0.0,0.0,-1.0) #11
	glEnd()

def horachica():
        glBegin(GL_POLYGON)
	glColor3f(1.0,1.0,1.0); #blanco
	glVertex3f(0.0,0.0,-1.0) #1
	glVertex3f(-3.0,4.0,-1.0) #2
	glVertex3f(0.0,8.0,-1.0) #3
	glVertex3f(-3.0,10.0,-1.0) #4
	glVertex3f(-1.0,12.0,-1.0) #5
	glColor3f(0.0,0.0,0.0); #negro
	glVertex3f(0.0,15.0,-1.0) #6
	glVertex3f(1.0,10.0,-1.0) #7
	glVertex3f(3.0,10.0,-1.0) #8
	
	glVertex3f(0.0,5.0,-1.0) #9
	glVertex3f(3.0,4.0,-1.0) #10
	glVertex3f(0.0,0.0,-1.0) #11
	glEnd()

def segunderochico():
        glBegin(GL_POLYGON)
        glColor3f(0.0,0.0,0.0);  # azul
        glVertex3f(0.0,-6.0,-1.0)
        glVertex3f(-1.0,-3.0,-1.0)
        glVertex3f(-1.0,3.0,-1.0)
        glVertex3f(-2.0,10.0,-1.0)
        glVertex3f(0.0,25.0,-1.0)
        glColor3f(1.0,1.0,0.0); # amarillo
        glVertex3f(2.0,10.0,-1.0)
        glVertex3f(1.0,3.0,-1.0)
       
        glVertex3f(2.0,-10.0,-1.0)
        glEnd()



#dibujo en 3D que aparecen       
def triangulos():
        #triangulos de los lados
        #triangulo de la derecha
        glBegin(GL_TRIANGLES);			# Start Drawing The Pyramid
	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 115.0, 130.0, -20.0);		# Top Of Triangle (Front)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(85.0,-140.0, 15.0);		# Left Of Triangle (Front)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( 145.0,-140.0, 15.0);

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 115.0, 130.0, -20.0);		# Top Of Triangle (Right)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( 145.0,-140.0, 15.0);		# Left Of Triangle (Right)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( 145.0,-140.0, -55.0);		# Right 

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 115.0, 130.0, -20.0);		# Top Of Triangle (Back)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( 145.0,-140.0, -55.0);		# Left Of Triangle (Back)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(85.0,-140.0, -55.0);		# Right Of 
		
		
	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 115.0, 130.0, -20.0);		# Top Of Triangle (Left)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(85.0,-140.0,-55.0);		# Left Of Triangle (Left)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(85.0,-140.0, 15.0);		# Right Of Triangle (Left)
	glEnd();

        #triangulo de la izquierda
	glBegin(GL_TRIANGLES);				    # Start Drawing The Pyramid

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( -115.0, 130.0, -20.0);		# Top Of Triangle (Front)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(-85.0,-140.0, 15.0);		# Left Of Triangle (Front)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( -145.0,-140.0, 15.0);

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( -115.0, 130.0, -20.0);		# Top Of Triangle (Right)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( -145.0,-140.0, 15.0);		# Left Of Triangle (Right)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( -145.0,-140.0, -55.0);		# Right 

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( -115.0, 130.0, -20.0);		# Top Of Triangle (Back)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( -145.0,-140.0, -55.0);		# Left Of Triangle (Back)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(-85.0,-140.0, -55.0);		# Right Of 
		
		
	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( -115.0, 130.0, -20.0);		# Top Of Triangle (Left)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(-85.0,-140.0,-55.0);		# Left Of Triangle (Left)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(-85.0,-140.0, 15.0);		# Right Of Triangle (Left)
	glEnd();



        #triangulo pequeno abajo
        
	glBegin(GL_TRIANGLES);					# Start Drawing The Pyramid 

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, -118.0, -20.0);		# Top Of Triangle (Front)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(30.0,-140.0, 15.0);		# Left Of Triangle (Front)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( -30.0,-140.0, 15.0);

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, -118.0, -20.0);		# Top Of Triangle (Right)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( -30.0,-140.0, 15.0);		# Left Of Triangle (Right)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( -30.0,-140.0, -55.0);		# Right 

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, -118.0, -20.0);		# Top Of Triangle (Back)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( -30.0,-140.0, -55.0);		# Left Of Triangle (Back)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(30.0,-140.0, -55.0);		# Right Of 
		
		
	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, -118.0, -20.0);		# Top Of Triangle (Left)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(30.0,-140.0,-55.0);		# Left Of Triangle (Left)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(30.0,-140.0, 15.0);		# Right Of Triangle (Left)
	glEnd();	

        #triangulo pequeno arriba
        glBegin(GL_TRIANGLES);					# Start Drawing The Pyramid 

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, 124.0, -20.0);		# Top Of Triangle (Front)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(30.0,146.0, 15.0);		# Left Of Triangle (Front)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( -30.0,146.0, 15.0);

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, 124.0, -20.0);		# Top Of Triangle (Right)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( -30.0,146.0, 15.0);		# Left Of Triangle (Right)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( -30.0,146.0, -55.0);		# Right 

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, 124.0, -20.0);		# Top Of Triangle (Back)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( -30.0,146.0, -55.0);		# Left Of Triangle (Back)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(30.0,146.0, -55.0);		# Right Of 
		
		
	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, 124.0, -20.0);		# Top Of Triangle (Left)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(30.0,146.0,-55.0);		# Left Of Triangle (Left)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(30.0,146.0, 15.0);		# Right Of Triangle (Left)
	glEnd();




        #triangulo pequeno arriba
        glBegin(GL_TRIANGLES);					# Start Drawing The Pyramid 

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, 168.0, -20.0);		# Top Of Triangle (Front)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(30.0,146.0, 15.0);		# Left Of Triangle (Front)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( -30.0,146.0, 15.0);

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, 168.0, -20.0);		# Top Of Triangle (Right)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f( -30.0,146.0, 15.0);		# Left Of Triangle (Right)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( -30.0,146.0, -55.0);		# Right 

	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, 168.0, -20.0);		# Top Of Triangle (Back)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f( -30.0,146.0, -55.0);		# Left Of Triangle (Back)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(30.0,146.0, -55.0);		# Right Of 
		
		
	glColor3f(1.0,0.0,0.0);			# Red
	glVertex3f( 0.0, 168.0, -20.0);		# Top Of Triangle (Left)
	glColor3f(0.0,0.0,1.0);			# Blue
	glVertex3f(30.0,146.0,-55.0);		# Left Of Triangle (Left)
	glColor3f(0.0,1.0,0.0);			# Green
	glVertex3f(30.0,146.0, 15.0);		# Right Of Triangle (Left)
	glEnd();
 




               

       	



#dibujo el muelle del centro
def muelle():
    glColor3f(0.0,1.0,0.0); #VERDE
    gleHelicoid (0.5, 6.0, 30.0, -12.0, 4.0, None, None, 0.0, 1080.0)
    #gleHelicoid(anchura,radio_apartir_de_centro,lo_grande_de_la_espiral,lo_que_sobresale_en_el_eje_z,)

    

   

#dibujo el cono_enrollao, que aparece arriba
def cono_enrollao():
    glePolyCone(((-80.0, 120.0, -3.0), (65.0, 120.0, -3.0), (60.0, 100.0, -3.0), (-60.0, 90.0, -3.0), (-55.0, 110.0, -3.0), (80.0, 110.0, -3.0)),
				((0.0, 0.0, 0.0), (0.0, 90.8, 0.3), (70.8, 90.3, 0.0), (60.2, 85.3, 00.9), (60.2, 80.8, 50.5), (0.0, 0.0, 0.0)), (1, 10, 5, 1.5, 5, 1))

    




        
#dibuja esferas
def esfera(x):
        x=x
        glColor3f(0.0,0.0,1.0); #azul	
        quad=gluNewQuadric()
        gluSphere(quad,x,30,30)
       


        
#dibujo el cono que aparece justo en el centro   
def cono():
        glColor3f(1.0,0.0,0.0);
        quad=gluNewQuadric()
        gluCylinder(quad,5,0,20,50,50)
      

def conochico():
        glColor3f(1.0,0.0,0.0);
        quad=gluNewQuadric()
        gluCylinder(quad,2,0,10,10,10)
        
        


def toroide():
        glColor3f(0.0,0.0,1.0);        #azul
        glutSolidTorus(4.0, 20.0, 50, 30)
        glColor3f(1.0,1.0,0.0);       # amarillo
        glutSolidTorus(2.0, 15.0, 50, 30)
        glColor3f(0.0,0.0,1.0);       # azul  
        glutSolidTorus(2.0, 11.0, 50, 30)
        glColor3f(1.0,1.0,0.0); # amarillo
        glutSolidTorus(2.0, 7.0, 50 , 30)
        glColor3f(0.0,0.0,1.0); #azul
        glutSolidTorus(2.0, 4.0, 50, 30)
        glColor3f(1.0,1.0,0.0); # amarillo
        glutSolidTorus(2.0, 0.05, 50, 30)
     
def muellespeque():
       
        gleHelicoid (0.8, 3.0, 5.0, -8.0, 4.0, None, None, 0.0, 1080.0)
        #gleHelicoid(anchura,radio_apartir_de_centro,lo_grande_de_la_espiral,lo_que_sobresale_en_el_eje_z,)


def cuadradito():
     glBegin(GL_POLYGON)
     glColor3f(0.0,0.0,1.0);       # azul  
     glVertex3f(0.0,0.0,0.0)
     glVertex3f(30.0,0.0,0.0)
     glVertex3f(30.0,30.0,0.0)
     glVertex3f(0.0,30.0,0.0)
     glEnd();
        
        
 

lastx=0
lasty=0


def MouseMotion (x, y):
	global lastx, lasty
	lastx = x
	lasty = y
	glutPostRedisplay ()





#-------------------------------------------------------------------------------------------------------
#----------------------------------------FUNCION DISPLAY------------------------------------------------
#-------------------------------------------------------------------------------------------------------
#funcion display que mediante listas va llamando a las funciones anteriores

	
def display():
	
	# limpia la ventana
	glClear (GL_COLOR_BUFFER_BIT)

	#obtenemos la hora actual
        actual = time.localtime()

        #Razonamiento sobbre los grados que tendra cada manecilla
        #Si 60 minutos son 360 grados, 1 minuto seran 6 grados (igual para los segundos)
        #Si 12 horas son 360 grados, 1 hora seran 30 grados
        gminut = -actual[4]     # almaceno los minutos, para utilizarlo mas abajo
        gHoras = -actual[3] * 30 +  gminut / 2   #grados de la hora, mas la proporcion de los minutos divido entre 2
        gMinutos = -actual[4] * 6  #grados de los minutos
        gSegundos = -actual[5] * 6 #grados de los segundos

        
		
	
	#tiene que ver con la rotacion
	glMatrixMode(GL_MODELVIEW)
	
	gleSetJoinStyle (TUBE_NORM_EDGE | TUBE_JN_ANGLE | TUBE_JN_CAP)
	glPushMatrix ()
	
	glTranslatef (0.0, 0.0, -1.0)
	glRotatef (lastx, 0.0, 1.0, 0.0)
	glRotatef (lasty, 1.0, 0.0, 0.0)



        
     
	
        #dibujo todos los triangulos en 3D que aparecen
	global trian
	trian = glGenLists(1)
	glNewList(trian, GL_COMPILE)
	triangulos()
	glEndList ()
	glCallList(trian)
	
	


        

        glEnable(GL_CULL_FACE)  #TENGO EN CUENTA LAS CARAS OCULTAS
        
	#dibujo los torides

        global tor
        tor = glGenLists(1)
        glNewList(tor, GL_COMPILE)
        # dibujo los toroides arriba a la izquierda, es decir la especie de circulos que el reloj tiene en rojo y amarillo en los laterales
	glTranslatef(-67.0,80.0,-20.0) #traslado la coordenada inicial
        glFrontFace(GL_CW)
	glCullFace(GL_BACK)
	toroide()                           #llamo a la funcion toroide
        glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (gMinutos, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	glCullFace(GL_BACK)
	glFrontFace(GL_CW)
        minuchico()
        glPopMatrix ()
        
        glPushMatrix ()                     #modifico la matriz con el Rotatef
        glRotatef (gHoras, 0.0, 0.0, 1.0)   #Para rotar sobre el eje Z
        glFrontFace(GL_CW)
        glCullFace(GL_BACK)
        horachica()
        glPopMatrix ()
        
        glPushMatrix ()                     #modifico la matriz con el Rotatef
        glRotatef (gSegundos, 0.0, 0.0, 1.0)  #Para rotar sobre el eje Z
        glFrontFace(GL_CW)
        glCullFace(GL_BACK)
        segunderochico()
        glPopMatrix ()
        glCullFace(GL_BACK)
        glFrontFace(GL_CCW)
        conochico()
        glTranslatef(67.0,-80.0,20.0) #traslado la coordenada a 0,0,0
        
        glTranslatef(-82.0,65.0,-20.5) #traslado la coordenada inicial
        glCullFace(GL_FRONT)
        cuadradito()                   #para tapar el hueco de atras
        glTranslatef(82.0,-65.0,20.5)#traslado la coordenada a 0,0,0
        


        
        # dibujo los toroides arriba a la derecha, es decir la especie de circulos que el reloj tiene en rojo y amarillo en los laterales
        glTranslatef(67.0,80.0,-20.0) #traslado la coordenada inicial
	toroide()                            #llamo a la funcion toroide
        glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (gMinutos, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	glFrontFace(GL_CW)
	glCullFace(GL_BACK)
	
        minuchico()
        glPopMatrix ()
        
        glPushMatrix ()                     #modifico la matriz con el Rotatef
        glRotatef (gHoras, 0.0, 0.0, 1.0)   #Para rotar sobre el eje Z
        glFrontFace(GL_CW)
        glCullFace(GL_BACK)
        
        horachica()
        glPopMatrix ()
        
        glPushMatrix ()                     #modifico la matriz con el Rotatef
        glRotatef (gSegundos, 0.0, 0.0, 1.0)  #Para rotar sobre el eje Z
        segunderochico()
        glPopMatrix ()
        glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
        
        conochico()
        glTranslatef(-67.0,-80.0,20.0) #traslado la coordenada a 0,0,0

        glTranslatef(52.0,65.0,-20.5) #traslado la coordenada inicial
        glCullFace(GL_FRONT)
        cuadradito()                   #para tapar el hueco de atras
        glTranslatef(-52.0,-65.0,20.5) #traslado la coordenada a 0,0,0
        

        
        
        
        # dibujo los toroides abajo a la derecha, es decir la especie de circulos que el reloj tiene en rojo y amarillo en los laterales
        glTranslatef(65.0,-80.0,-20.0) #traslado la coordenada inicial
	toroide()                            #llamo a la funcion toroide
        glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (gMinutos, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	glFrontFace(GL_CW)
	glCullFace(GL_BACK)
	
        minuchico()
        glPopMatrix ()
    
        glPushMatrix ()                     #modifico la matriz con el Rotatef
        glRotatef (gHoras, 0.0, 0.0, 1.0)   #Para rotar sobre el eje Z
        glFrontFace(GL_CW)
        glCullFace(GL_BACK)
        
        horachica()
        glPopMatrix ()
        
        glPushMatrix ()                     #modifico la matriz con el Rotatef
        glRotatef (gSegundos, 0.0, 0.0, 1.0)  #Para rotar sobre el eje Z
        glFrontFace(GL_CW)
        glCullFace(GL_BACK)
        
        segunderochico()
        glPopMatrix ()
        glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
        
        conochico()
        glTranslatef(-65.0,80.0,20.0) #traslado la coordenada a 0,0,0

        glTranslatef(50.0,-95.0,-20.5) #traslado la coordenada inicial
        glCullFace(GL_FRONT)
        cuadradito()                   #para tapar el hueco de atras
        glTranslatef(-50.0,95.0,20.5) #traslado la coordenada a 0,0,0
        
	
        # dibujo los toroides abajo a la izquierda, es decir la especie de circulos que el reloj tiene en rojo y amarillo en los laterales
        glTranslatef(-65.0,-80.0,-20.0) #traslado la coordenada inicial
	toroide()                            #llamo a la funcion toroide
        glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (gMinutos, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	glFrontFace(GL_CW)
	glCullFace(GL_BACK)
	
        minuchico()
        glPopMatrix ()
        
        glPushMatrix ()                     #modifico la matriz con el Rotatef
        glRotatef (gHoras, 0.0, 0.0, 1.0)   #Para rotar sobre el eje Z
        glFrontFace(GL_CW)
        glCullFace(GL_BACK)
       
        horachica()
        glPopMatrix ()
        
        glPushMatrix ()                     #modifico la matriz con el Rotatef
        glRotatef (gSegundos, 0.0, 0.0, 1.0)  #Para rotar sobre el eje Z
        glFrontFace(GL_CW)
        glCullFace(GL_BACK)
        
        segunderochico()
        glPopMatrix ()
        glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
        
        conochico()
        glTranslatef(65.0,80.0,20.0) #traslado la coordenada a 0,0,0

        glTranslatef(-80.0,-95.0,-20.5) #traslado la coordenada inicial
        glCullFace(GL_FRONT)
        cuadradito()                   #para tapar el hueco de atras
        glTranslatef(80.0,95.0,20.5)#traslado la coordenada a 0,0,0
        
        glEndList ()
        glCallList(tor)


        
        




       
        
	# dibujo el rombo rojo, que se vera por delante
        global polirecu
        polirecu = glGenLists(1)
        glNewList (polirecu, GL_COMPILE)
        glCullFace(GL_BACK)
        poli_recur()
        glEndList ()
	glCallList(polirecu)





		
	


	
	#dibujo la especie de triangulo a la izquierda abajo y arriba en el rombo
	global poligon
	poligon = glGenLists(1)
        glNewList(poligon, GL_COMPILE)
        glFrontFace(GL_CW)
        glCullFace(GL_FRONT)
	poligono()
	glEndList ()
	glCallList(poligon)






	#dibujo la especie de triangulo a la derecha abajo del rombo
	global poligon2
	poligon2 = glGenLists(1)
        glNewList(poligon2, GL_COMPILE)
        glFrontFace(GL_CCW)
        glCullFace(GL_FRONT)
	poligono2()
	glEndList ()
	glCallList(poligon2)






	#dibujo los muelles pequenos que aparecen en el rombo rojo
	global muepeq
	muepeq = glGenLists(1)
	glNewList(muepeq, GL_COMPILE)
	glTranslatef(25.0,20.0,-1.0) #traslado la coordenada inicial
	glColor3f(0.0,0.0,1.0);			# Blue
	glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (time.time()%(1.0)/1 * -360, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	glFrontFace(GL_CW)
        glCullFace(GL_FRONT)
	muellespeque()
	glPopMatrix ()
	
	glTranslatef(-25.0,-20.0,1.0) #vuelvo a 0,0,0
	glTranslatef(10.0,40.0,-1.0) #traslado la coordenada inicial
	glColor3f(0.0,1.0,0.0);			
	glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (time.time()%(0.5)/0.5 * 360, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	muellespeque()
	glPopMatrix ()
	
	glTranslatef(-10.0,-40.0,1.0) #vuelvo a 0,0,0
	glTranslatef(45.0,40.0,-1.0) #traslado la coordenada inicial
	glColor3f(1.0,1.0,0.0);	
	glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (time.time()%(4.0)/4 * -360, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	muellespeque()
	glPopMatrix ()
	
	glTranslatef(-45.0,-40.0,1.0) #vuelvo a 0,0,0
	glEndList ()
	glCallList(muepeq)





	

	#dibujo el muelle del centro
	global mue
	mue = glGenLists(1)
	glNewList(mue, GL_COMPILE)
	glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (time.time()%(8.0)/8 * 360, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	muelle()
	glPopMatrix ()
	glEndList ()
	glCallList(mue)
	



	
	 
	# DIBUJO LOS RECTANGULOS DE 12,3,6,9
	global rectan
	rectan = glGenLists(1)
	glNewList(rectan, GL_COMPILE)
	glTranslatef(0.0,0.0,0.0)
	glColor3f(0.0,0.0,0.0); #NEGRO
	glFrontFace(GL_CCW)
        glCullFace(GL_FRONT)
	rectangulo()
	glEndList ()
	glCallList(rectan)
	
	




	# DIBUJO LOS RECTANGULOS DE 1,2,4,5,7,8,10,11
	global rectan2
	rectan2 = glGenLists(1)
	glNewList(rectan2, GL_COMPILE)
	glColor3f(1.0,0.5,0.0); #naranja
	glFrontFace(GL_CCW)
        glCullFace(GL_FRONT)
	rectangulo2()
	glEndList ()
	glCallList(rectan2)
	



	

	# DIBUJO LOS SEGUNDOS
	global rectan3
	rectan3 = glGenLists(1)
	glNewList(rectan3, GL_COMPILE)
	glColor3f(1.0,1.0,0.0); # amarillo
	glFrontFace(GL_CCW)
        glCullFace(GL_FRONT)
	rectangulo3()
	glEndList ()
	glCallList(rectan3)




       

        #dibujo los numeros romanos
	global nume
	nume = glGenLists(1)
	glNewList(nume, GL_COMPILE)
	glFrontFace(GL_CW)
        glCullFace(GL_FRONT)
	numeros_romanos()
	glEndList ()
	glCallList(nume)







        #dibujo la manecilla del minutero
	global minut
	minut = glGenLists(1)
	glNewList(minut, GL_COMPILE)
	glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (gMinutos, 0.0, 0.0, 1.0) #Para rotar sobre el eje Z
	glFrontFace(GL_CW)
        glCullFace(GL_BACK)
	minu()
	glEndList ()
	glCallList(minut)
	glPopMatrix ()                      #vuelvo a poner la matriz que tenia anteriormente






	#dinujo la manecilla de la hora
	global hor
	hor = glGenLists(1)
	glNewList(hor, GL_COMPILE)
	glPushMatrix ()                     #modifico la matriz con el Rotatef
	glRotatef (gHoras, 0.0, 0.0, 1.0)   #Para rotar sobre el eje Z
	glFrontFace(GL_CW)
	glCullFace(GL_BACK)
	hora()
	glEndList ()
	glCallList(hor)
	glPopMatrix ()                       #vuelvo a poner la matriz que tenia anteriormente
    
        




	#dibujo la manecilla del segundero
	global segunder
	segunder = glGenLists(1)
	glNewList(segunder, GL_COMPILE)
	glPushMatrix ()                       #modifico la matriz con el Rotatef
	glRotatef (gSegundos, 0.0, 0.0, 1.0)  #Para rotar sobre el eje Z
	glFrontFace(GL_CW)
	glCullFace(GL_BACK)
	segundero() 
	glEndList ()
	glCallList(segunder)
	glPopMatrix ()                        #vuelvo a poner la matriz que tenia anteriormente


	

	
        
        #dibujo el cono que aparece justo en el centro
	global con
	con = glGenLists(1)
	glNewList(con, GL_COMPILE)
	glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
	cono()
	glEndList ()
	glCallList(con)






        #dibujo el cono_enrollao,que aparece arriba
	global enro
	enro = glGenLists(1)
	glNewList(enro, GL_COMPILE)
	glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
	cono_enrollao()
	glEndList ()
	glCallList(enro)



    

	#comienzo a dibujar las esferas
	global esfe
	esfe = glGenLists(1)
	glNewList(esfe, GL_COMPILE)
	glTranslatef(115.0,115.0,-20.0) #traslado la coordenada inicial
	glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
	esfera(20)
	glTranslatef(-115.0,-115.0,20.0)  #vuelvo a 0,0,0
	glTranslatef(-115.0,115.0,-20.0) #traslado la coordenada inicial
	glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
	esfera(20)
	glTranslatef(115.0,-115.0,20.0) #traslado la coordenada a 0,0,0
	glTranslatef(115.0,142.0,-20.0)
	glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
	esfera(12)
	glTranslatef(-115.0,-142.0,20.0) #vuelvo a 0,0,0
	glTranslatef(-115.0,142.0,-20.0)
	glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
	esfera(12)
	glTranslatef(115.0,-142.0,20.0) #vuelvo a 0,0,0
	glTranslatef(115.0,157.0,-20.0)
	glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
	esfera(6)
	glTranslatef(-115.0,-157.0,20.0)#vuelvo a 0,0,0
	glTranslatef(-115.0,157.0,-20.0)
	glFrontFace(GL_CCW)
        glCullFace(GL_BACK)
	esfera(6)
	glTranslatef(115.0,-157.0,20.0)#vuelvo a 0,0,0
	glEndList ()
	glCallList(esfe)


	# dibujo el rombo rojo, que se vera por detras
        global polirecu2
        polirecu2 = glGenLists(1)
        glNewList (polirecu2, GL_COMPILE)
        glCullFace(GL_FRONT)
        poli_recur()
        glEndList ()
	glCallList(polirecu2)


        
	

	
        glDisable(GL_CULL_FACE) #desactivo lo de las caras ocultas


	
	#voy eliminando las listas que ya no me hacen falta
	glDeleteLists(polirecu, GL_COMPILE)
	glDeleteLists(polirecu2, GL_COMPILE)
	glDeleteLists(trian, GL_COMPILE)
	glDeleteLists(tor, GL_COMPILE)
	glDeleteLists(poligon, GL_COMPILE)
	glDeleteLists(poligon2, GL_COMPILE)
	glDeleteLists(muepeq, GL_COMPILE)
	glDeleteLists(rectan, GL_COMPILE)
	glDeleteLists(rectan2, GL_COMPILE)
	glDeleteLists(rectan3, GL_COMPILE)
	glDeleteLists(minut, GL_COMPILE)
	glDeleteLists(hor, GL_COMPILE)
	glDeleteLists(nume, GL_COMPILE)
	glDeleteLists(mue, GL_COMPILE)
	glDeleteLists(enro, GL_COMPILE)
	glDeleteLists(esfe, GL_COMPILE)
	glDeleteLists(segunder, GL_COMPILE)
	

	
	
	
	
 	# vuelca el buffer
	glFlush ();
	glPopMatrix ()
	
	glutSwapBuffers ()	
	
	
	

        


def init():
   # seleccionamos el color de fondo de ventana	 como negro
   glClearColor (0.0, 0.0, 0.0, 0.0) 

   # Creamos la vista  (proyeccion ortogonal)
   glMatrixMode(GL_PROJECTION)
   glLoadIdentity()
   glOrtho(-170.0, 170.0, -170.0, 170.0, -170.0, 170.0)


# Iniciamos la ventana y la forma de mostrarla

glutInit(sys.argv)
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
glutInitWindowSize(480, 480)
glutInitWindowPosition(100, 100)
glutCreateWindow("Reloj_Mata_Tiempo")
init()
glutIdleFunc(display)
glutMotionFunc(MouseMotion)
glutDisplayFunc(display)

glutMainLoop()


